package src.main.BehavioralPatterns.Iterator;

import java.util.ArrayList;
import java.util.Stack;

// 古籍区
public class AncientBooksCollection implements BookCollection {
    private Stack<Book> books = new Stack<Book>(); // 使用栈存储古籍

    // 添加古籍
    public void pushBook(Book book) {
        books.push(book);
    }

    // 实现创建迭代器方法，返回实例
    @Override
    public Iterator<Book> createIterator() {
        return new ReverIterator(books);
    }
}
